package com.smmisia.shop.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.Getter;

@Getter
public enum ExpiredEnum {
    //0过期自动退款,1过期自动失效不退款
    REFUND(0, "过期自动退款"),
    INVALID(1, "过期自动失效不退款");

    @EnumValue
    private Integer code;
    private String desc;

    ExpiredEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static ExpiredEnum getEnum(Integer code) {
        for (ExpiredEnum expiredEnum : ExpiredEnum.values()) {
            if (expiredEnum.getCode().equals(code)) {
                return expiredEnum;
            }
        }
        return null;
    }
}
